import { close, connect, ObjectId } from "../../util/mongo"

export default  defineEventHandler(async (event) => {
  const id = getRouterParam(event,"id")
  console.log('id:',id);
  
  const {client,db } = await connect()
  const material =  db.collection('material');

  const _id = new ObjectId(id)
  const docs = await material.findOne({_id})

  close(client)
  return docs
})